package com.sell.service;

import com.sell.dataobject.ProductInfo;
import com.sell.dto.CartDTO;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.List;

/**
 * Author: Xukai
 * Description:
 * CreateDate: 2018/6/21 15:56
 * Modified By:
 */
public interface ProductService {

    ProductInfo findOne(String productId);

    /*
     * Author: XuKai
     * Description: 查询在售的全部商品
     * Created: 2018/6/21 15:59
     * Params: []
     * Returns: java.util.List<com.sell.dataobject.ProductInfo>
     */
    List<ProductInfo> findUpAll();

    /*
     * Author: XuKai
     * Description: 查询所有商品，带分页
     * Created: 2018/6/21 15:59
     * Params: []
     * Returns: java.util.List<com.sell.dataobject.ProductInfo>
     */
    Page<ProductInfo> findAll(Pageable pageable);

    ProductInfo save(ProductInfo productInfo);

    /*
     * Author: XuKai
     * Description: 加库存
     * Created: 2018/6/29 14:22
     * Param cartDTOList
     * Returns: void
     */
    void increaseStock(List<CartDTO> cartDTOList);

    /*
     * Author: XuKai
     * Description: 减库存
     * Created: 2018/6/29 14:22
     * Param cartDTOList
     * Returns: void
     */
    void decreaseStock(List<CartDTO> cartDTOList);

    /*
     * Author: XuKai
     * Description: 上架
     * Created: 2018/6/29 14:22
     * Param productId
     * Returns: com.sell.dataobject.ProductInfo
     */
    ProductInfo onSale(String productId);

    /*
     * Author: XuKai
     * Description: 下架
     * Created: 2018/6/29 14:22
     * Param productId
     * Returns: com.sell.dataobject.ProductInfo
     */
    ProductInfo offSale(String productId);

}
